﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;

namespace Creative85.Framework.Utilities
{
    public static class EncryptHelper
    {
        private static string hex2str(byte[] bs)
        {
            var sb = new StringBuilder();
            foreach (var b in bs)
            {
                sb.Append(b.ToString("X2"));
            }
            return sb.ToString();
        }
        public static string Md5(string val)
        {
            byte[] bs = Encoding.UTF8.GetBytes(val);
            using (var md5 = MD5.Create())
            {
                bs = md5.ComputeHash(bs);
            }
            var str = hex2str(bs);
            return str;
        }
    }
}
